Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to Display Profile Field in the Topic Template


  • luvs
    Member

    @luvs123

    I have a profile field.. that I want to display in the topic template…

    How do I do it? `get_profile_data` doesn’t work

Viewing 20 replies - 1 through 20 (of 20 total)

  • luvs
    Member

    @luvs123

    I’m trying to pass the current poster ID for the forums.., but it’s NOT WORKING!!! :( :( with the get_profile_data


    luvs
    Member

    @luvs123

    Bump


    luvs
    Member

    @luvs123

    BUMp again


    function_im_awesome() {
    Participant

    @vegasparty607

    Im looking for this tooo


    luvs
    Member

    @luvs123

    bump


    luvs
    Member

    @luvs123

    wow…. why won’t anyone answer me?

    bump again


    luvs
    Member

    @luvs123

    I’m going to keep bumping until someone answers me


    Hugo Ashmore
    Keymaster

    @hnla

    Rather than simply bumping and waiting for someone why don’t you try a generally accepted tech forum approach of actually explaining what you are trying to do in a code sense with examples of what you have tried to date that has or hasn’t worked, this way you are more likely to get a response from developers if they can see your working, your approach and suggest ways of achieving what you want to do. Your post simply lacks any detail and begs a whole heap of questions before anyone could begin to help.

    I would also suggest you start over as few are likely to look past this many ‘bumps’ :)


    luvs
    Member

    @luvs123

    why can’t you help me?


    luvs
    Member

    @luvs123

    guess I’m back to bumping!


    luvs
    Member

    @luvs123

    bump


    luvs
    Member

    @luvs123

    bump


    r-a-y
    Keymaster

    @r-a-y

    Check out the bp_profile_field_data() function (located in bp-xprofile/bp-xprofile-templatetags.php):
    https://buddypress.trac.wordpress.org/browser/tags/1.2.8/bp-xprofile/bp-xprofile-templatetags.php#L551

    It takes “user_id” as a parameter.

    Since you’re referring to the topic template, you’ll need to use a custom function to grab the topic poster ID since a native one doesn’t exist in BP at the moment. Here’s a post I made awhile back that will help:
    https://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/how-to-display-the-user-post-count-in-topic-php#post-92596

    Also luvs, be aware that the people who post on these support forums are volunteers who take time out of their day to help the community.


    luvs
    Member

    @luvs123

    So…. something like:


    luvs
    Member

    @luvs123

    *update** the code I tried above ^^ does not work.


    luvs
    Member

    @luvs123

    I also tried:

    `function profile_field_topic( $args = ” ) {
    global $topic_template;

    $defaults = array(

    ‘field’ => false, // Field name or ID.
    ‘user_id’ => $topic_template->post->poster_id
    );

    $r = wp_parse_args( $args, $defaults );
    extract( $r, EXTR_SKIP );

    return apply_filters( ‘bp_get_profile_field_data’, xprofile_get_field_data( $field, $user_id ) );

    }`

    but no go…


    r-a-y
    Keymaster

    @r-a-y

    Your first example code is closer, but you need to put those parameters in an array:

    `bp_profile_field_data( array( ‘field’ => FIELDID, ‘user_id’ => my_topic_poster_id() ) );`


    luvs
    Member

    @luvs123

    Uhh it sort of worked how I wanted. I want to have an image associated with the profile field, so the field is a link when clicked. But I only want the image to appear if the user has filled it out: so I tried:

    ` 66, ‘user_id’ => my_topic_poster_id() ) ) ) : ?>
    <a href="”>
    `

    but all it does is display the link, not the image. What am I doing wrong?


    luvs
    Member

    @luvs123

    Nevermind! Changed it to `bp_get_profile_field_data(` and it worked, thanks!


    opatachibueze
    Member

    @opatachibueze

Viewing 20 replies - 1 through 20 (of 20 total)
  • The topic ‘How to Display Profile Field in the Topic Template’ is closed to new replies.
Skip to toolbar